package top.mcwebsite.playandroid.business.me.impl.main.vm

import top.mcwebsite.playandroid.common.user.api.IUserService
import top.mcwebsite.playandroid.common.user.api.model.CoinInfo
import top.mcwebsite.playandroid.lib.mvi.base.IIntent
import top.mcwebsite.playandroid.lib.mvi.base.IUiEffect
import top.mcwebsite.playandroid.lib.mvi.base.IUiState
import top.mcwebsite.playandroid.lib.servicemanager.core.ServiceManager

data class MeUiState(
    val isLogin: Boolean = ServiceManager.getService<IUserService>().isLogin(),
    val userAvatar: String = "",
    val username: String = "",
    val level: Int = 0,
    val rank: String = "",
    val coinCount: Int? = null,
    val snackMessage: String? = null
) : IUiState

sealed class MeIntent : IIntent {
    data object LoginIntent : MeIntent()

    data object GoUserCoinPageIntent : MeIntent()

    data object GoSettingsPageIntent: MeIntent()
}

sealed class MeUiEffect : IUiEffect {
    data object NavigateToLoginEffect : MeUiEffect()

    data class NavigateToUserCoinPageUiEffect(val coinInfo: CoinInfo) : MeUiEffect()

    data object NavigationToSettingsPageUiEffect : MeUiEffect()
}